home *** CD-ROM | disk | FTP | other *** search
/ Amiga News 95 / Amiga News 95.iso / dpat / dpat31 / iobject / sources.lha / sources / InitObject.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-23  |  1.3 KB  |  82 lines

  1. // Initialisation de EasyGadgets 
  2. // (C) Christophe PASSUELLO
  3. // Fri Jan 22 14:19:51 1993
  4.  
  5.  
  6. #include <exec/types.h>
  7. #include <exec/memory.h>
  8. #define  INTUITION_PREFERENCES_H 0
  9. #include <intuition/intuition.h>
  10. #include "IObject_priv.h"
  11.  
  12.  
  13. // definition de l'image du cycle
  14. const static UWORD CycleData[]=
  15. {
  16.     0x7C00, 0xC600, 0xC600, 0xDF80, 0xCF00, 0xC600, 0xC000, 0xC000, 0xC600, 0x7C00
  17. };
  18.  
  19. struct Image CycleImage=
  20. {
  21.     5, 2,
  22.     9, 10, 1,
  23.     NULL,
  24.     1,0,
  25.     NULL
  26. };
  27.  
  28.  
  29. // Image pour le check
  30. const static UWORD CheckData[]=
  31. {
  32.     0x000e, 0x0018, 0x0030, 0x0060, 0xf0c0, 0x3980, 0x1f00, 0x0e00
  33. };
  34.  
  35. struct Image CheckImage=
  36. {
  37.     4, 2,
  38.     15, 8, 1,
  39.     NULL,
  40.     1, 0,
  41.     NULL
  42. };
  43.  
  44.  
  45. //
  46. // Mets les images en CHIP-RAM
  47. //
  48. BOOL InitEasyGadget()
  49. {
  50.     UWORD *image;
  51.  
  52.     // Mets le cycle en memoire
  53.     if (image = (UWORD *) AllocMem( sizeof(CycleData), MEMF_CHIP))
  54.     {
  55.         CycleImage.ImageData = image;
  56.         memcpy(image, CycleData, sizeof(CycleData));
  57.     }
  58.     else
  59.         return (FALSE);
  60.  
  61.     // mets le checkImage en CHIP
  62.     if (image = (UWORD *) AllocMem( sizeof(CheckData), MEMF_CHIP))
  63.     {
  64.         CheckImage.ImageData = image;
  65.         memcpy(image, CheckData, sizeof(CheckData));
  66.     }
  67.     else
  68.         return (FALSE);
  69.  
  70.     return (TRUE);
  71. }
  72.  
  73.  
  74. //
  75. // Libere les images
  76. //
  77. VOID ExitEasyGadget()
  78. {
  79.     if (CycleImage.ImageData)    FreeMem(CycleImage.ImageData, sizeof(CycleData));
  80.     if (CheckImage.ImageData)    FreeMem(CheckImage.ImageData, sizeof(CheckData));
  81. }
  82.